<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app1">
        <form action="">
            <div>
                用户名：<input type="text" v-model='uname' @keyup.delete='deleteuname'>
            </div>
            <div>
                <!-- 按键修饰符 -->
                密码：<input type="text" v-model='pwd' @keyup.enter='submit' @keyup.delete='deleteuname'>
            </div>
            <div>
                <input type="button"value='提交' @click='submit'>
            </div>
        </form>
    </div>
</body>
<script src="./V/vue.js"></script>
<script>
    // 可以直接使用键盘上的键位来触发事件
    var vm1 = new Vue({
    el:'#app1',
    data:{
        uname:'',
        pwd:''
    
    },
    methods:{
        submit:function(e){
            // console.log(1);
            console.log(this.uname,this.pwd);
        },deleteuname:function(e){
            this.uname=''
            this.pwd=''
        }
    }
})
</script>
</html>